<?php

class Application_Model_Article extends Ahs_Model
{

    /**
     * @var integer
     */
    protected $_id;
    /**
     * @var integer 
     */
    protected $_author_id;
    /**
     * @var string
     */
    protected $_name;
    /**
     * @var string
     */
    protected $_text;
    /**
     * @var integer
     */
    protected $_chapter_id;
    /**
     * @var datetime
     */
    protected $_creationdate;
    /**
     * @var datetime
     */
    protected $_modifieddate;
    /**
     * @var datetime
     */
    protected $_deleteddate;
    
    
    /**
     * @return integer
     */    
    public function getId() {
        return $this->_id;
    }
    /**
     * @param integer $id
     */
    public function setId($id) {
        $this->_id = $id;
    }
    
    /**
     * @return integer
     */    
    public function getAuthorId() {
        return $this->_author_id;
    }
    /**
     * @param integer $id
     */
    public function setAuthorId($id) {
        $this->_author_id = $id;
    }
    /**
     * Get the author object
     * @return Application_Model_User
     */
    public function getAuthor()
    {
        if($this->_author_id != null)
        {
            // Get author
            $mapper = new Application_Model_UserMapper();
            return $mapper->fetchById($this->AuthorId);
        }
        
        return null;
    }
   
    /**
     * @return string
     */
    public function getName() {
        return $this->_name;
    }
    /**
     * @param string $name
     */
    public function setName($name) {
        $this->_name = $name;
    }
    
    /**
     * @return string
     */
    public function getText() {
        return $this->_text;
    }
    /**
     * @param string $text
     */
    public function setText($text) {
        $this->_text = $text;
    }
    
    /**
     * @return integer
     */    
    public function getChapterId() {
        return $this->_chapter_id;
    }
    /**
     * @param integer $chapterId
     */
    public function setChapterId($id) {
        $this->_chapter_id = $id;
    }
    /**
     * Get the chapter object
     * @return Application_Model_Chapter
     */
    public function getChapter()
    {
        if($this->_chapter_id != null)
        {
            // Get author
            $mapper = new Application_Model_ChapterMapper();
            return $mapper->fetchById($this->_chapter_id);
        }
        
        return null;
    }
   
    /**
     * @return datetime
     */
    public function getCreationDate() {
        return $this->_creationdate;
    }
    /**
     * @param datetime $date
     */
    public function setCreationDate($date) {
        $this->_creationdate = $date;
    }
    
    /**
     * @return datetime
     */
    public function getModifiedDate() {
        return $this->_modifieddate;
    }
    /**
     * @param datetime $date
     */
    public function setModifiedDate($date) {
        $this->_modifieddate = $date;
    }
    
    /**
     * @return datetime
     */
    public function getDeletedDate() {
        return $this->_deleteddate;
    }
    /**
     * @param datetime $date
     */
    public function setDeletedDate($date) {
        $this->_deleteddate = $date;
    }
}

